<?php
require './vendor/autoload.php';
use Qiniu\Auth;
$accessKey = 'naQm4T_P4GQeSpOcOvRCT3Ob73Gf2GNhmIEJeo3x';
$secretKey = 'N0iwl_8zMj_xedBi1KV1f3kADNn9eby1WQFIQu0e';
$auth = new Auth($accessKey, $secretKey);

$domain  = 'http://7xkfmq.com1.z0.glb.clouddn.com/';

if(isset($_GET["file"])){
    $baseUrl = $domain.$_GET["file"];
    $authUrl = $auth->privateDownloadUrl($baseUrl);  
}else{
    echo "vGift: oh, i am lost! hillsdong@163.com";
    exit;
}


?>

<!doctype html>
<html lang="en">
<head>
    <title>vGift</title>
	<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
	
	<link href="favicon.ico" rel="shortcut icon">

	<!--[if lt IE 9]>
      <script src="js/Respond-1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="container">
    

	<div class="text-left col-md-12 wrapper">
		<h1 class="text-left col-md-12 ">
			<img src="logo.png" style="width:40px;">
            vGift
            <span style="font-size:12px;vertical-align:0.3em;color:#fff;padding:.2em .6em .3em;border-radius:0.25em; background-color: #999;">BETA</span> 
		</h1>
    </div>

    <div id="video"></div>
</div>

<?php if(isset($authUrl)):?>
<script type="text/javascript" src="http://content.jwplatform.com/libraries/ZLll0F6y.js"></script>

<script type="text/javascript">
var playerInstance = jwplayer("video");
    playerInstance.setup({
        autostart:true,
        file: "<?=$authUrl?>",
        image: "http://example.com/uploads/myPoster.jpg",

    });
</script>
<?php endif?>

</body>
</html>
